package com.itzhihao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

@Data
@TableName(value = "glgl_address")
public class Address extends BaseEntity{

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "address_id",type = IdType.ASSIGN_ID)
    private Long Id;

    @NotBlank(message = "地址归属人ID不饿能为空")
    private Long stakeholderId;

    @NotBlank(message = "经度不为空")
    private Double longitude;

    @NotBlank(message = "纬度不为空")
    private Double latitude;

    @TableField(value = "pos_name")
    private String posName;

    @TableField(value = "pos_address")
    private String posAddress;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1(3\\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$",
                message = "手机号格式不正确")
    private String phone;

    private String name;

    @TableField(value = "is_default")
    private Integer isDefault;

    @TableField(value = "is_deleted")
    private Integer isDeleted;


}
